package main

import "fmt"

var mem = make(map[int]int)

func fib(N int) int {
	if N <= 1 {
		return N
	}
	fmt.Println("N=", N)
	if _, ok := mem[N]; !ok {
		mem[N] = fib(N-1) + fib(N-2)
	}

	return mem[N]
}

func main() {
	N := 6
	res := fib(N)
	fmt.Println("res=", res)
}
